<?php defined('_JEXEC') or die('Restricted access'); 
$event = $this->eventList[0];
echo "<a href=\"".$this->baseurl."/index.php?option=".$this->option."&view=signupreport&group_id=".$this->eventGroup->id."\">".JText::_("SHOW_RELATED_EVENTS")."</a>";
?><h1><?php JText::printf("SIGNUPREPORT"); ?></h1>
<table>
	<tr>
		<td></td>
		<td colspan="<?php echo count($event->categoryList) ?>">
			<b><?php echo JHTML::date($event->date);?></b><br/>
			<?php echo $event->description_html ?>
			<?php 
			JText::printf("HEAD_CHEF");
			echo ":&nbsp;".$event->organiser_description 
			?>
		</td>
	</tr>
	<tr>
		<td>
			<b><?php JText::printf("MEMBER") ?></b>
		</td>
		<?php
		foreach ($event->categoryList as $category) {
			?>
			<td>
				<b><?php JText::printf($category->display_name) ?></b>
			</td>
			<?php
		}
		?>
	</tr>
<?php 
$rowStyle[0] = "background-color:rgb(160,160,160)";
$rowStyle[1] = "background-color:rgb(210,210,210)";
$rowStyleId = 0;
foreach($this->memberList as $member) {
	$rowStyleId = 1 - $rowStyleId;
	?>
	<tr>
		<td>
			<?php echo $member->name ?>
		</td>
		<?php 
		foreach ($event->categoryList as $category) {
			?>
			<td style="text-align:center;<?php echo $rowStyle[$rowStyleId]?>">
				<?php
				echo $category->participantsList[$member->id];
				?>
			</td>
			<?php 
		}
		?>
	</tr>
	<?php
}
?>
</table>
<!-- Assumed crew member and open event => option to close event (and display default with totals) -->
<form action="<?php echo $this->baseurl ?>/index.php" method="post">
<?php
if($event->status == CMeals::STATUS_OPEN) {
	?>
	<table>
		<tr>
			<td><?php JText::printf("CLOSING_DATE"); ?></td>
			<td>
				<?php echo JHTML::date($event->closing_date) ?>
			</td>
		</tr>
		<tr>
			<td><?php JText::printf("STATUS"); ?></td>
			<td>
				<input type="radio" name="status" value="<?php echo CMeals::STATUS_OPEN ?>" checked><?php JText::printf("STATUS_OPEN") ?></input>
				<br/>
				<input type="radio" name="status" id="closedRadio" value="<?php echo CMeals::STATUS_CLOSED ?>"><?php JText::printf("STATUS_CLOSED") ?></input>
			</td>
		</tr>
	</table>
	<button type="button" onclick="if (document.getElementById('closedRadio').checked) { this.form.task.value='save'; } this.form.submit()"><?php JText::printf("SAVE"); ?></button>
	<button type="submit"><?php JText::printf("CANCEL"); ?></button>
	<?php 
}
?>
<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
<input type="hidden" name="view" value="signupreport" />
<input type="hidden" name="task" value="cancel" />
<input type="hidden" name="event_id" value="<?php echo $event->id; ?>" />
<input type="hidden" name="group_id" value="<?php echo $event->group_id; ?>" />
</form>
<br/>&nbsp;
